package com.ibm.testbed.script.adjust;

import org.eclipse.jface.text.DocumentEvent;
import org.eclipse.jface.text.IDocumentListener;

public class TestbedDocumentListener implements IDocumentListener {

	
	private TestbedDocumentListener(){};
	
	public static final TestbedDocumentListener INSTANCE=new TestbedDocumentListener();
	
	@Override
	public void documentAboutToBeChanged(DocumentEvent event) {

		int start=event.getOffset();
		int length=event.getLength()-event.getText().length();
		
		TestbedAdjustLocationEvent locationEvent=new TestbedAdjustLocationEvent(start, length);
		
		TestbedEventQueue.INSTANCE.addEvent(locationEvent);
		
	}

	@Override
	public void documentChanged(DocumentEvent event) {

	}

}
